<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Anderson Bernardo - Sistemas</title>
</h:head>
<h:body>
	<h:form>
		<p:panel header="Aplicação protótipo" id="mainPanel">
			<p:inputText id="search" />
			<p:commandButton value="Pesquisar"
				actionListener="#{sessionManagedBean.popularTabela()}"
				update="mainPanel" />

			<p:dataTable id="table" value="#{sessionManagedBean.list}" var="pojo">
				<p:column>
					<p:rowToggler />
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="Nome" />
					</f:facet>
					<h:outputText value="#{pojo.name}" />
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="Valor" />
					</f:facet>
					<h:outputText value="#{pojo.value}" />
				</p:column>

				<p:rowExpansion>
					<p:dataTable id="subTable" value="#{sessionManagedBean.listSub}"
						var="sub">
						<p:column>
							<f:facet name="header">
								<h:outputText value="Sub-Campo" />
							</f:facet>
							<h:outputText value="#{sub.name}" />
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="Valor" />
							</f:facet>
							<h:outputText value="#{sub.value}" />
						</p:column>
					</p:dataTable>
				</p:rowExpansion>
			</p:dataTable>

		</p:panel>
	</h:form>

	<p:ajaxStatus>
		<f:facet name="prestart">
			<h:outputText value="Starting..." />
		</f:facet>
		<f:facet name="error">
			<h:outputText value="Error" />
		</f:facet>
		<f:facet name="success">
			<h:outputText value="Success" />
		</f:facet>
		<f:facet name="default">
			<h:outputText value="Idle" />
		</f:facet>
		<f:facet name="start">
			<h:outputText value="Sending" />
		</f:facet>
		<f:facet name="complete">
			<h:outputText value="Done" />
		</f:facet>
	</p:ajaxStatus>

</h:body>
</html>
